<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- v5 -->
  <script src='https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js'></script>
</head>

<body>
  <button class="btn">点我</button>
  <script>
    import { createWorker } from 'tesseract.js';
    console.log(createWorker);
    // (async () => {
    //   const worker = await createWorker('eng');
    //   const ret = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
    //   console.log(ret.data.text);
    //   await worker.terminate();
    // })();
    // let a  = [1,2,3,4,5,6,7,8,9,10]
    // let [y] = a;
    // console.log(y);


    // let person = { name: "Lydia" };
    // const members = [person];
    // person = null;

    // console.log(members);
    // const person = {
    //     firstName: "Lydia",
    //     lastName: "Hallie",
    //     pet: {
    //         name: "Mara",
    //         breed: "Dutch Tulip Hound"
    //     },
    //     getFullName() {
    //         return `${this.firstName} ${this.lastName}`;
    //     }
    // };

    // console.log(person.pet?.name);
    // console.log(person.pet?.family?.name);
    // console.log(person.getFullName?.());
    // console.log(person.getLastName?.());
    // const myPromise = Promise.resolve(Promise.resolve("Promise!"));
    // function funcOne() {
    //     myPromise.then(res => res).then(res => console.log(res));//Promise
    //     setTimeout(() => console.log("Timeout!"), 0);//Timeout
    //     console.log("Last line!");//Last line
    // }
    // async function funcTwo() {
    //     const res = await myPromise;
    //     console.log(await res);
    //     setTimeout(() => console.log("Timeout!"), 0);
    //     console.log("Last line!");
    // }
    // funcOne();//Last line Promise
    // funcTwo();

    // const p = new Promise((resolve, reject) => {
    //     resolve('Promise')
    // })
    // let btn = document.querySelector('button');
    // btn = onclick = () => {
    //     setTimeout(() => console.log("Timeout!"), 0);//上下都可以放
    //     console.log(p.then(res => console.log(res)));
    //     //setTimeout(() => console.log("Timeout!"), 0)
    // }
    // const myPromise = Promise.resolve(Promise.resolve("Promise!"));

    // function funcOne() {
    //   myPromise.then(res => {
    //     console.log("执行第一个then", res)
    //     return res
    //   }).then(res => {
    //     console.log('执行第二个then', res)
    //   });
    //   setTimeout(() => console.log("Timeout!"), 0);
    //   console.log("Last line!");
    // }

    // async function funcTwo() {
    //   console.log('进入funcTwo')
    //   const res = await myPromise;
    //   console.log('执行完第一个await，继续往下执行')
    //   console.log(await res);
    //   console.log('执行完第二个await，继续往下执行')
    //   setTimeout(() => console.log("Timeout!"), 0);
    //   console.log("Last line!");
    // }

    // funcOne();
    // funcTwo();
  </script>
</body>

</html>